const userRouter = require('../routes/users')
const followRouter = require('../routes/follow')
const tagRouter = require('../routes/tags')
const articleRouter = require('../routes/articles')
const favoriteRouter = require('../routes/favorites')
const commentsRouter = require('../routes/comments')

const initRoute = (app) => {
    // 接口测似
    app.get('/', (req, res) => {
        // console.log(req.user,req.token);
        res.json({
            status: 'API is Ok'
        })
    })

    //使用路由模块：/api/v1/users 模块的公共地址
    app.use('/api/v1/users', userRouter)
    //关注路由模块
    app.use('/api/v1/follow', followRouter)
    //tag路由模块
    app.use('/api/v1/tags', tagRouter)
    //article路由模块
    app.use('/api/v1/articles', articleRouter)
    //favorite路由模块
    app.use('/api/v1/favorites', favoriteRouter)
    //comments路由模块
    app.use('/api/v1/comments', commentsRouter)

}

module.exports = initRoute